#include <iostream>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
    string out;
    for (string buff; cin >> buff; buff += (buff.empty()?"":" ") + out)
    cout << out << endl;
}